{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-body">
        <form action="{:request()->url()}" class="layui-form" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-block">
                    <input type="text" name="name" value="{$data.name|default=''}" autocomplete="off" placeholder="请输入姓名" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">手机</label>
                <div class="layui-input-block">
                    <input type="text" name="mobile" value="{$data.mobile|default=''}" autocomplete="off" placeholder="请输入手机号" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">密码</label>
                <div class="layui-input-block">
                    <input type="password" name="password" value="" autocomplete="off" placeholder="请输入密码" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">部门</label>
                <div class="layui-input-block">
                    <select name="group_id" lay-search>
                        <option value="0">请选择部门</option>
                        {foreach name="user_group" item="v"}
                        <option value="{$v.id}" {if condition="isset($data) and $data.group_id eq $v.id"}selected="selected"{/if}>{neq name="v.level" value="1"}|{php}for($i=1;$i<$v['level'];$i++){echo ' ----';}{/php}{/neq} {$v.name}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">角色</label>
                <div class="layui-input-block">
                    {foreach name="user_rule" item="v"}
                        {if isset($data) and in_array($v.id,$data.rule_id)}
                        <input type="checkbox" name="rule_id[]" title="{$v.name}" value="{$v.id}" checked>
                        {else}
                        <input type="checkbox" name="rule_id[]" title="{$v.name}" value="{$v.id}">
                        {/if}
                    {/foreach}
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    {:token_field()}
                    <button class="layui-btn" lay-filter="t" lay-submit="">保存</button>
                    <button class="layui-btn layui-btn-primary" type="reset">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
